/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-03-10
 * Time: 22:25
 */
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-03-10
 * Time: 22:14
 */
//class Student {
//    private String name;//学生姓名
//    private int age;//学生年龄
//
//    public void eat() {
//        System.out.println("eat<>");
//    }
//    public void sleep() {
//        System.out.println("sleep<>");
//    }
//
//    public void eat(String name,int age) {
//        System.out.println("名字"+name+"年龄"+age);
//    }
//
//    //    public String getName() {
////        return name;
////    }
////    public void setName(String name) {
////        this.name=name;
////    }
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public int getAge() {
//        return age;
//    }
//
//    public void setAge(int age) {
//        this.age = age;
//    }
//
//    @Override
//    public String toString() {
//        return "Student{" +
//                "name='" + name + '\'' +
//                ", age=" + age +
//                '}';
//    }
//}

class Student {
    private String name;
    private int age;

    //构造一个方法  方法名要与类名相同   不要写类型  无参
    public Student() {
        System.out.println("student《》");
    }
    public Student(String name,int age) {
        this.name=name;
        this.age =age;
        //System.out.println("zijietiaodong");
        System.out.println("name: "+name+"age: "+age);
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class TestDemo {
//    public static void main(String[] args) {
//        Student student =new Student();
//        student.eat("sfx",18);
//        student.setName("sfx");
//        student.setAge(19);
//        System.out.println(student.getName());
//        System.out.println(student);
//    }
        public static void main(String[] args) {

            Student student =new Student();
            student.setAge(19);
            student.setName("sfx");
            Student Student1 =new Student("sfx",19);
        }

}

